﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DataAccess;
using Business;

namespace TimKiemDiaDiem
{
    public partial class frmTimKiemDiaDiem : Form
    {
        

        public frmTimKiemDiaDiem()
        {
            InitializeComponent();

            Db.Initation("", "Database20111015", "", "");
        }

        private void TraCuuDiaDiem()
        {
            lblThongBao.Visible = false;

            String TenDichVu = cbbTenDichVu.Text;
            String TuKhoa = txtTuKhoa.Text;

            List<DiaDiemDTO> DanhSachDiaDiem = XL_DiaDiem.tracuuDiaDiem(TenDichVu, TuKhoa);
            DanhMucDiaDiemCtrl.DanhSachDiaDiem = DanhSachDiaDiem;

            if (0 == DanhSachDiaDiem.Count)
            {
                lblThongBao.Visible = true;
                lblThongBao.Text = "Không tìm thấy kết quả";
            }
        }

        private void frmTimKiemDiaDiem_Load(object sender, EventArgs e)
        {
            cbbTenDichVu.DataSource = XL_DichVu.layDanhSachDichVu();  
        }


        private void btnTim_Click(object sender, EventArgs e)
        {
            this.TraCuuDiaDiem();
        }


        private void txtTuKhoa_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                this.TraCuuDiaDiem();
            }
        }

        



    }
}
